package com.javalab.recorder.listener;

import java.util.EventListener;

import javax.swing.event.EventListenerList;

import org.apache.log4j.Logger;

public class EventDispatcher extends EventListenerList {
	/**
	 *
	 */
	private static final long serialVersionUID = 1901292001023080375L;

	private static Logger logger = Logger.getLogger(EventDispatcher.class);

	@SuppressWarnings({ "unchecked" })
	public void subscribeEvent(EventListener eventListener) {
		logger.info("Subscribe event. EventListener - " + eventListener.getClass());
		add((Class<EventListener>)eventListener.getClass(), eventListener);
	}

	@SuppressWarnings("unchecked")
	public void unsubscribeEvent(EventListener eventListener) {
		logger.info("Unsubscribe event. EventListener - " + eventListener.getClass());
		add((Class<EventListener>)eventListener.getClass(), eventListener);
	}
}
